<%--

    Licensed to Apereo under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Apereo licenses this file to you under the Apache License,
    Version 2.0 (the "License"); you may not use this file
    except in compliance with the License.  You may obtain a
    copy of the License at the following location:

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

--%>
<jsp:directive.include  file="includes/top.jsp"/>



<script>
    function refreshcaptchacode(obj) {
        obj.setAttribute("src", base_path+ "/captchacode?date=" + new Date());
    }
</script>



<div id="cookiesDisabled"  class="errors"  style="display:none;">

    <h2><spring:message code="screen.cookies.disabled.title"/></h2>

    <p><spring:message  code="screen.cookies.disabled.message"/></p>

</div>





<c:if  test="${not empty registeredService}">

    <c:set var="registeredServiceLogo" value="images/webapp.png"/>

    <c:set var="registeredServiceName" value="${registeredService.name}"/>

    <c:set var="registeredServiceDescription" value="${registeredService.description}"/>



    <c:choose>

        <c:when test="${not empty mduiContext}">

            <c:if  test="${not empty mduiContext.logoUrl}">

                <c:set  var="registeredServiceLogo" value="${mduiContext.logoUrl}"/>

            </c:if>

            <c:set var="registeredServiceName" value="${mduiContext.displayName}"/>

            <c:set var="registeredServiceDescription" value="${mduiContext.description}"/>

        </c:when>

        <c:when test="${not empty registeredService.logo}">

            <c:set var="registeredServiceLogo" value="${registeredService.logo}"/>

        </c:when>

    </c:choose>





    <p/>

</c:if>



<div class="box" id="login">

    <form:form  method="post" id="fm1"  commandName="${commandName}"  htmlEscape="true">



        <form:errors path="*"  id="msg"  cssClass="errors"  element="div"  htmlEscape="false"/>



        <h2><spring:message code="screen.welcome.instructions"/></h2>

        <section class="row">
            <label for="merchantid">merchantid</label>
            <form:input cssClass="required"   cssErrorClass="error" id="merchantid"  size="25"  tabindex="1"    path="merchantid"   autocomplete="off"  htmlEscape="true"/>
        </section>

        <section class="row">

            <label for="username"><spring:message code="screen.welcome.label.netid"/></label>

            <c:choose>

                <c:when  test="${not empty sessionScope.openIdLocalId}">

                    <strong><c:out value="${sessionScope.openIdLocalId}"/></strong>

                    <input  type="hidden" id="username"  name="username"  value="<c:out  value="${sessionScope.openIdLocalId}"/>"/>

                </c:when>

                <c:otherwise>

                    <spring:message  code="screen.welcome.label.netid.accesskey"  var="userNameAccessKey"/>

                    <form:input cssClass="required"   cssErrorClass="error" id="username"  size="25"  tabindex="1"  accesskey="${userNameAccessKey}"   path="username"   autocomplete="off"  htmlEscape="true"/>

                </c:otherwise>

            </c:choose>

        </section>

        <section  class="row">
            <label for="password"><spring:message  code="screen.welcome.label.password"/></label>
            <spring:message  code="screen.welcome.label.password.accesskey"  var="passwordAccessKey"/>

            <form:password cssClass="required"  cssErrorClass="error"  id="password" size="25"  tabindex="2" path="password"  accesskey="${passwordAccessKey}"  htmlEscape="true" autocomplete="off"/>
            <span  id="capslock-on"  style="display:none;"><p><img src="images/warning.png"  valign="top"><spring:message code="screen.capslock.on"/></p></span>
        </section>
        <!-- 验证码 -->
        <section class="row">
            <label for="imgverifycode"><spring:message  code="screen.welcome.label.verifycode"/></label>
            <spring:message  code="screen.welcome.label.verifycode.accesskey"  var="verifycodeAccessKey"/>
            <form:input cssClass="required" cssErrorClass="error" id="imgverifycode" path="imgverifycode" htmlEscape="true" autocomplete="off" placeholder="requeire vericy code" />
            <br/>
            <img onclick="this.src='captcha.jpg?'+Math.random()" width="93"
                 height="30" src="captcha.jpg">

                <%--<img id="cimg" src="${base_path}/captchacode" onclick="refreshcaptchacode(this)" title="not see"/>--%>
        </section>






        <section class="rowbtn-row">


            <input type="hidden" name="lt"  value="${loginTicket}"/>
            <input type="hidden" name="execution"  value="${flowExecutionKey}"/>

            <input  type="hidden"  name="_eventId"  value="submit"/>

            <input class="btn-submit"  name="submit"  accesskey="l"  value="<spring:message  code="screen.welcome.button.login"/>"   tabindex="6"    type="submit"/>

            <input class="btn-reset"  name="reset"  accesskey="c"  value="<spring:message code="screen.welcome.button.clear"/>"  tabindex="7"   type="reset"/>

        </section>
    </form:form>
</div>

<jsp:directive.include  file="includes/bottom.jsp"/>